package com.fxu.gen.enums;

import com.fxu.framework.core.enums.BaseEnum;
import lombok.AllArgsConstructor;

/**
 * 字段类型
 */
@AllArgsConstructor
public enum FormType implements BaseEnum {
    //1:文本框,2:选择器,3:日期,4:日期时间,5:数字,6:单选,7:多选,8:多行文本,9:富媒体,10:图片,11:文件,12:密文
    INPUT(1, "文本框"),
    SELECT(2, "选择器"),
    DATE(3, "日期"),
    TIME(4, "日期时间"),
    NUMBER(5, "数字"),
    RADIO(6, "单选"),
    CHECKBOX(7, "多选"),
    MUL_INPUT(8, "多行文本"),
    RICH_TEXT(9, "富媒体"),
    IMAGE(10, "图片"),
    FILE(11, "文件"),
    SECRET(12, "密文"),
    MY_CONF(13, "选择配置"),
    ;

    int code;
    String desc;

    @Override
    public Integer code() {
        return code;
    }
    @Override
    public String desc() {
        return desc;
    }

    public static FormType find(Integer code) {
        return code == null ? null : BaseEnum.findOne(FormType.values(), v -> code.equals(v.code));
    }
}